//
//  FlyUtilMacro.h
//  PartyBuildingCloud
//
//  Created by lifayu on 16/9/21.
//  Copyright © 2016年 贵阳飞云科技有限公司. All rights reserved.
//

#ifndef FlyUtilMacro_h
#define FlyUtilMacro_h

//判断是真机还是模拟器
#if TARGET_OS_IPHONE
//真机
#endif

#if TARGET_IPHONE_SIMULATOR
//模拟器
#endif

// 判断字符串是否为空
#define FLYStringIsEmpty(str) ([str isKindOfClass:[NSNull class]] || str == nil || [str length] < 1 ? YES : NO )
// 判断数组是否为空
#define FLYArrayIsEmpty(array) (array == nil || [array isKindOfClass:[NSNull class]] || array.count == 0)
// 判断字典是否为空
#define FLYDictIsEmpty(dic) (dic == nil || [dic isKindOfClass:[NSNull class]] || dic.allKeys == 0)
// 判断是否是空对象
#define FLYObjectIsEmpty(_object) (_object == nil \
|| [_object isKindOfClass:[NSNull class]] \
|| ([_object respondsToSelector:@selector(length)] && [(NSData *)_object length] == 0) \
|| ([_object respondsToSelector:@selector(count)] && [(NSArray *)_object count] == 0))

// 弱引用
#define FlyWeakSelf __weak typeof(self) weakSelf = self;


// 获取屏幕宽度与高度
#define ScreenWidth \
([[UIScreen mainScreen] respondsToSelector:@selector(nativeBounds)] ? [UIScreen mainScreen].nativeBounds.size.width/[UIScreen mainScreen].nativeScale : [UIScreen mainScreen].bounds.size.width)

#define ClubMargin 120
#define CommonMargin 10

#define ScreenHeight \
([[UIScreen mainScreen] respondsToSelector:@selector(nativeBounds)] ? [UIScreen mainScreen].nativeBounds.size.height/[UIScreen mainScreen].nativeScale : [UIScreen mainScreen].bounds.size.height)

#define ScreenSize \
([[UIScreen mainScreen] respondsToSelector:@selector(nativeBounds)] ? CGSizeMake([UIScreen mainScreen].nativeBounds.size.width/[UIScreen mainScreen].nativeScale,[UIScreen mainScreen].nativeBounds.size.height/[UIScreen mainScreen].nativeScale) : [UIScreen mainScreen].bounds.size)
#define NavigationBarHeight           self.navigationController.navigationBar.frame.size.height
#define StatusBarHeight     [UIApplication sharedApplication].statusBarFrame.size.height
#define BottomIdicatorHeight ([UIApplication sharedApplication].statusBarFrame.size.height > 20 ? 34 : 0)
#define TabBarHeight   49

// 获取沙盒Document路径
#define DocumentPath [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) firstObject]
// 获取沙盒temp路径
#define TempPath NSTemporaryDirectory()
// 获取沙盒Cache路径
#define CachePath [NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES) firstObject]

// 开发的时候打印，但是发布的时候不打印的NSLog
#ifdef DEBUG
#define DebugLog(fmt, ...) NSLog((@"[%s Line %d]" fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__)
#else
#define DebugLog(...)
#endif

#define UIColorFromRGB(rgbValue) \
[UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16)) / 255.0 \
green:((float)((rgbValue & 0xFF00) >> 8)) / 255.0 \
blue:((float)(rgbValue & 0xFF)) / 255.0 alpha:1.0]

#define UIColorFromRGBA(rgbValue, alphaValue) \
[UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16)) / 255.0 \
green:((float)((rgbValue & 0xFF00) >> 8)) / 255.0 \
blue:((float)(rgbValue & 0xFF)) / 255.0 \
alpha:alphaValue]


// 定义通用颜色
#define kBlackColor         [UIColor blackColor]
#define kDarkGrayColor      [UIColor darkGrayColor]
#define kLightGrayColor     [UIColor lightGrayColor]
#define kWhiteColor         [UIColor whiteColor]
#define kGrayColor          [UIColor grayColor]
#define kRedColor           [UIColor redColor]
#define kGreenColor         [UIColor greenColor]
#define kBlueColor          [UIColor blueColor]
#define kCyanColor          [UIColor cyanColor]
#define kYellowColor        [UIColor yellowColor]
#define kMagentaColor       [UIColor magentaColor]
#define kOrangeColor        [UIColor orangeColor]
#define kPurpleColor        [UIColor purpleColor]
#define kClearColor         [UIColor clearColor]
#define kRandomFlatColor    [UIColor randomFlatColor]


#define AppSecondMainColor UIColorFromRGB(0xFF6684)
#define AppMainColor   UIColorFromRGB(0x35A2F2)
#define AppPriceTextColor   UIColorFromRGB(0xCD2668)
#define AppTextColor UIColorFromRGB(0x3D4151)
#define AppNameTextColor UIColorFromRGB(0x398EFF)
#if DEBUG
#define ServerAddressWeb        @"http://admin.manshiguang.it/"
#else
#define ServerAddressWeb        @"http://admin.manshiguang.it/"

#endif

#define WxAppKey                 @"wx2cf33d8cfd622981"
#define AppOpenUrl               @"com.xo.enjoy.shopping.street-blue.share"
#define BTPaymentOpenUrl         @"com.xo.enjoy.shopping.street-blue.payments"
#define JPushAppKey @"3d422d687f191a3150d40cb8"


#define AppShareFromToken  @"AppShareFromToken"
#define DefaultCountryCode  @"DefaultCountryCode"


#pragma mark 字体
// 平方常规
#define CHINESE_PingFangRegular(a) ({\
UIFont * font = [UIFont fontWithName:@"PingFangSC-Regular" size:(a)];\
font? font: [UIFont systemFontOfSize:(a)];\
})

#define kPingFangFontRegularSize(R) CHINESE_PingFangRegular(R)
// 平方中粗
#define CHINESE_PingFangMedium(a) ({\
UIFont * font = [UIFont fontWithName:@"PingFangSC-Medium" size:(a)];\
font? font: [UIFont boldSystemFontOfSize:(a)];\
})

#define kPingFangFontMediumSize(R) CHINESE_PingFangMedium(R)

//系统常规
#define kSystemFontSize(R) [UIFont systemFontOfSize:(R)]
//系统中粗
#define kSystemFontBlodSize(R) [UIFont boldSystemFontOfSize:(R)]

#define CopyStringProperty  @property (copy, nonatomic) NSString *
#define StrongNumberProperty @property (strong, nonatomic) NSNumber *
#define AssignProperty @property (assign, nonatomic)
#define StrongProperty @property (strong, nonatomic)

#define RelaceEmptyStr(str) FLYStringIsEmpty(str)?@"-":str

#endif /* FlyUtilMacro_h */
